package com.action;

import com.controller.ClusterAnalysis;
import com.controller.DataPoint;

import java.util.List;

/**
 * Created by lirance on 16/4/15.
 */
public class getClustersAction extends BaseAction {
    List<DataPoint> dataPoints;
    private List serviceList;
    int clusteNum = 10;
    List clustlist;

    public List<DataPoint> getDataPoints() {
        return dataPoints;
    }

    public void setDataPoints(List<DataPoint> dataPoints) {
        this.dataPoints = dataPoints;
    }

    public List getServiceList() {
        return serviceList;
    }

    public void setServiceList(List serviceList) {
        this.serviceList = serviceList;
    }

    public int getClusteNum() {
        return clusteNum;
    }

    public void setClusteNum(int clusteNum) {
        this.clusteNum = clusteNum;
    }

    public List getClustlist() {
        return clustlist;
    }

    public void setClustlist(List clustlist) {
        this.clustlist = clustlist;
    }

    @Override
    public String execute() throws Exception {
        ClusterAnalysis cl = new ClusterAnalysis();
        this.setClustlist(cl.getClusterLists(clusteNum));
        cl.insert(clusteNum);
        this.setServiceList(this.getAllService().getGetServicesService().getAllEntities());
        this.setDataPoints(cl.getdataPoints());

        return SUCCESS;
    }

}
